package com.ssm.studen.service.impl;

import com.ssm.studen.dao.ExamquestionpaperDao;
import com.ssm.studen.model.Examquestionpaper;
import com.ssm.studen.service.ExamquestionpaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 试卷考题表：
 *          实现业务及流程接口当中的内容
 */
@Service
public class ExamquestionpaperServiceImpl implements ExamquestionpaperService {

    @Autowired
    private ExamquestionpaperDao examquestionpaperDao;


    /**
     * 试卷考题表的更新
     * @param examquestionpaper
     * @return
     */
    @Override
    public int updateExamQuestionpaper(Examquestionpaper examquestionpaper) {
        /*
         * 业务流程判断
         * */
        int isUpdate = 0;
        try {
            isUpdate = examquestionpaperDao.updateExamQuestionpaper(examquestionpaper);
        }catch (Exception e){
            isUpdate = -1;
            //打印更新时报错的情况
            System.out.println("更新试卷考题表信息时执行SQL报错的原因是：" + e.getMessage());
        }
        return isUpdate;
    }


    /**
     * 试卷考题表查询
     * @param eqpnum
     * @return
     */
    @Override
    public List<Examquestionpaper> selectExamQuestionpaper(int eqpnum) {
        List<Examquestionpaper> list = examquestionpaperDao.selectExamQuestionpaper(eqpnum);
        return list;
    }
}
